<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="com.entity.Order" %>
<%@ page import="com.entity.Department" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.dao.OrderCtrl" %>
<%@ page import="com.dao.GoodsCtrl" %>
<%@ page import="com.dao.DepartmentCtrl" %>
<%@ page import="java.sql.Time" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>库存管理</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
		<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/global.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/modal.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
<div id="header">
			<div class="col w5 bottomlast">
				<a href="" class="logo">
					<img src="images/logo.gif" alt="Logo" />
				</a>
			</div>
			<div class="col w5 last right bottomlast">
				<p class="last"> 用户名<span class="strong">Admin,</span> <a href="">注销</a></p>
			</div>
			<div class="clear"></div>
		</div>
		<div id="wrapper">
			<div id="minwidth">
				<div id="holder">
					<div id="menu">
						<div id="left"></div>
						<div id="right"></div>
						<ul>
							<li>
								<a href="index.jsp" class="selected"><span>库存管理</span></a>
							</li>
							<li>
								<a href="newGood.jsp" ><span>新建库存</span></a>
							</li>
							<li>
								<a href="order.jsp"><span>查看领用单</span></a>
							</li>
						</ul>
						<div class="clear"></div>
					</div>
					<div id="submenu">
						<div class="modules_left">
						<div class="col w1">
							<div class="content">
								<label for="select">Select:</label>
						    </div>
						</div>
								
							<div class="col w1">
								<div class="content">
									<form action="test.php">
										<p>
											<select name="select" id="select">
											<%
											DepartmentCtrl dc= new DepartmentCtrl();
											ArrayList<Department> departList = dc.getDepartment();
											if(departList==null)
											{
												departList= new ArrayList<Department>();
											}
											int num = departList.size();
											for(int i =0; i<num; i++){
												int depart_id = departList.get(i).getDepart_id();
												String depart_name= departList.get(i).getDepart_name();
											
											%>
												<option id=<%=depart_id%>  value=<%=depart_name %>> <%=depart_name %> </option>
												<%} %>
											</select>
											<br />
										</p>
									</form>
								</div>
							</div>
						</div>
						<div class="title">
							Users
						</div>
						<div class="modules_right">
							<div class="module search">
								<form action="">
									<p><input type="text" value="Search..." name="user_search" /></p>
								</form>
							</div>
						</div>
					</div>
					<div id="desc">
						<div class="body">
						<form name="myform" method="post" id="myform" action="">
							<div class="col w10 last">
								<div class="content">
								<table>
										<tr>
											<th>类型</th>
											<th>名称</th>
											<th>型号</th>
											<th>数量</th>
											<th>最小数量</th>
											<th>位置</th>
											<th>资产编号</th>
											<th>s/n编号</th>										
										</tr>
										<%
										OrderCtrl oc= new OrderCtrl();
										ArrayList<Order> orderlist = oc.getOrders();
										if(orderlist==null)
										{
											orderlist = new ArrayList<Order>();
										}
										int account = orderlist.size();
										for(int i =0;i<account;i++)
										{
											
											int order_id = orderlist.get(i).getOrder_id();
											int goods_id = orderlist.get(i).getGood_id();
											String goods_name = oc.findByGoodsId(goods_id);
											int depart_id = orderlist.get(i).getDepart_id();
											String depart_name = oc.findByDepartId(depart_id);
											String staff =  orderlist.get(i).getStaff();
											Time time = orderlist.get(i).getTime();
											String cause = orderlist.get(i).getCause();
											int amount = orderlist.get(i).getAmount();
											String other = orderlist.get(i).getOther();
											
											//System.out.println(goods_name);
											
										
										%>
										<tr id=<%=order_id%>>
										<%-- <td class="checkbox"><input type="checkbox" name="id" onclick='unselectall()' value=<%=goods_id %> /> --%><%-- <input type="text" name="number" id="number" class="text w_2" value=<%=number%>/> --%><!-- </td> -->
											<td><%=goods_name %></td>
											<td><%=depart_name %></td>
											<td><%=amount %></td>
											<td><%=staff %></td>
											<td><%=time %>
											</td>
											<td>
											<%=cause %>
											</td>
											<td>
											<%=other %>
											</td>
											
										</tr>
									<%} %>	
										
									</table>
									<%
                                    /*  String arr[]=  request.getParameterValues("id");//.getAttributeNames("id");//.getParameterValues("id");//这时接收到的就是一个数组了
                                     for(String check:arr){
                                    	 if(check!=null&&!"".equals(check)){
                                    		System.out.println(check+"被选中！"); 
                                    	 }
                                     } */
                                     /* for(int i=0;i<arr.length;i++){
                                      out.println(arr[i]);
                                      } */
                                     %>	
						<!-- <a href="" class="button" onclick="CheckSingle()" id="create-user">
						<small class="icon check"></small>
						<span>领用</span></a> -->
										
						</div>
						<div class="clear"></div>
							</div>
							</form>
							<div class="clear"></div>
						</div>
						
						<div class="clear"></div>
						<div id="body_footer">
							<div id="bottom_left"><div id="bottom_right"></div></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div id="footer">
			<p class="last"><a href=""></a></p>
		</div>
		
		
</body>
</html>